﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace StarControl
{
    //
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Main : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        MileniumFalconShip mShip;
        PegasusShip pShip; 
        StarfighterShip sfShip;
        ValkyrieShip vShip;
        Limpeza limpa;
        Colisao colisao;
        Explosao explosao;

        public Obstaculo[] obstaculos;
       
		public Main()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            limpa = new Limpeza(this);
        }

        protected override void Initialize()
        {

            base.Initialize();
            colisao = new Colisao(this);
            //IsMouseVisible = true;

        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

        }

        protected override void UnloadContent()
        {
        }
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            limpa.Update(gameTime);

            // Gerencia o numero de obstaculos na tela
            //limpa.gerenciarObstaculos();

            colisao.ocorreuColisaoTiroMeteoro();

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            if (explosao.explodindo)
            {
                explosao.Draw(gameTime, spriteBatch);
            }


            base.Draw(gameTime);
        }
    }
}
